import { request } from './request'

const get = (parameter: object) => {
	return request({
		url: `/policy`,
		method: 'get',
		params: parameter,
	})
}

const add = (data: object) => {
	return request({
		url: `/policy`,
		method: 'post',
		data: data,
		headers: { 'Content-Type': 'multipart/form-data;charset=UTF-8' },
	})
}

const del = (id: number) => {
	return request({
		url: `/policy/delete/${id}`,
		method: 'delete',
	})
}

const download = (id: number) => {
	return request({
		url: `/policy/download/${id}`,
		method: 'get',
	})
}
const censor = (id: number, censor_stat: number) => {
	return request({
		url: `/policy/update/${id}/${censor_stat}`,
		method: 'get',
	})
}

const update = (data: object) => {
	return request({
		url: `/policy/update`,
		method: 'post',
		data: data,
	})
}

const shenhe = (id: number, censor: number) => {
	return request({
		url: `/policy/update/${id}/${censor}`,
		method: 'get',
	})
}

export default {
	get,
	add,
	del,
	download,
	update,
	censor,
}
